<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			function getAge(age) {
				var age="";
			    if (age > 0 && age <= 6) {
			        return '童年';
			    } else if (age >= 7 && age < 17) {
			        return '少年';
			    } else if (age >= 18 && age < 40) {
			        return '青年';
			    } else if (age >= 41 && age < 65) {
			        return '中年';
			    } else {
			        return '老年';
			    }
				return age;
			}
			var result = getAge(20);
			alert("20岁正处在"+result+"时期");

		</script>
	</body>
</html>
